Environment structure

Lexical environments in T are hierarchically arranged. Variable bindings are inherited from outer (superior) contours to inner (inferior) ones. At the top of the hierarchy is a root environment, which has no bindings in it. Inferior to that is a standard environment which has bindings for all standard system variables, for example, CAR and +. (See section 2.3.) Inferior to the standard environment are environments into which programs have been or are to be loaded. In the standard environment, the variable STANDARD-ENV is bound to the standard environment itself.

When a T system starts up, it sets up an initial environment configuration which has one environment inferior to the standard environment, called the user environment. The variable USER-ENV is bound in the standard environment to the user environment. The user environment has no variable bindings in it at first; however, the initial read-eval-print loop (section 18.3) is started in this environment, so that if no other provision is made, user global variable (i.e. definitions) will be made in the user environment.

In T 3.1, there is another environment called the implementation environment (page [*]). This is the value of T-IMPLEMENTATION-ENV in the standard environment. The implementation environment is not inferior to the standard environment, but instead is inferior to the root.

In T 3.0, the initial locales look like:

                                 <root>
                                /  |  \
                              /    |    \
                            /      |      \
                          /        |        \
                        /          |          \
       t-implementation-env   standard-env   scheme-env
                               /   |   \
                             /     |     \
                           /       |       \
                     user-env  orbit-env  scheme-internal-env

<root>
The <root> locale is the conceptual root of the locale tree. It does not actually exist. The <root> locale is empty, it contains no variable bindings.

t-implementation-env
The t-implementation-env is the environment which contains the system internals.

standard-env
The standard-env is the environment defined by the T manual.

user-env
The user-env is the default environment for the read-eval-print-loop on system startup.

orbit-env
The orbit-env is the environment which contains the internals of the ORBIT compiler.

scheme-internal-env
The scheme-internal-env contains the system internals for the Scheme environment.

scheme-env
The scheme-env is the environment defined by Revised3 Report on Scheme.

Empty environments may be created using MAKE-EMPTY-LOCALE (page [*]). For example:
\begin{codexenv}
(DEFINE *ALMOST-USELESS-ENV* (MAKE-EMPTY-LOCALE '*ALMOST-USELES...
...EVAL '(+ 5 (- 21 13)) *ALMOST-USELESS-ENV*) $\Longrightarrow$\ 13
\end{codexenv}


\begin{inset}
% latex2html id marker 21722
{}
The value of {\tt STANDARD-ENV} is...
...onment\/}
in the sense of section \ref{section:standardEnvironment}.
\end{inset}


\begin{inset}{}
The value of {\tt USER-ENV} is an environment (a locale)
inferio...
...-ENV}, however, with {\tt MAKE-LOCALE} (page
\pageref{MAKE-LOCALE}).
\end{inset}